<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 300px;
      height: 300px;
    }
  </style>
</head>

<body>
  <div class="asd"></div>

  <script>

    const r = Math.floor(Math.random() * 256)
    const g = Math.floor(Math.random() * 256)
    const b = Math.floor(Math.random() * 256)
    const div = document.querySelector('div')
    div.style.backgroundColor = `rgb(${r},${g},${b})`
  </script>

</body>

</html>